package 强化训练;

import java.util.Scanner;

public class day25星际密码 {
    public static void main(String[] args) {
        int[] arr = new int[10001];
        arr[1] = 1;
        arr[2] = 2;
        for (int i = 3; i < 10001; i++) {
            arr[i] = arr[i-1] + arr[i-2];
            //只保存后四位数
            arr[i] = arr[i] % 10000;
        }

        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()){
            int n = sc.nextInt();
            StringBuilder sb= new StringBuilder();
            for (int i = 1; i < n; i++) {
                int xi = sc.nextInt();
                //将获取到的数据按照4位输出，不足四位，高位补0
                sb.append(String.format("%04d",arr[xi]));
            }
            System.out.println(sb);
        }
    }
}
